<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>react作业</title>
    <script src="./node_modules/react/umd/react.development.js"></script>
    <script src="./node_modules/react-dom/umd/react-dom.development.js"></script>
</head>
<body>
    <div id="box"></div>
    <script>
        /*
       * 三个API：
       * React.createElement(type代表元素的类型, 属性， 节点/子节点)
       * ReactDOM.createRoot   创建根节点 
       * render(ele) // 渲染元素到页面中
       */
        // 1.创建元素
       let workTitle = React.createElement('h2',{className:'title'},'你好,react')
            //    console.log(workTitle);
        // 2. 渲染元素到页面中 (1)创建根节点 
        // 17版本用法
        //    ReactDOM.render(workTitle, document.getElementById('box'))

        // 18版本用法
        let root = ReactDOM.createRoot(document.getElementById('box'))
        // 渲染元素到页面中
        root.render(workTitle)

        // console.log('VDOM', workTitle)
        // console.log('TDOM', document.getElementById('box'))

        //   debugger
       // 判断数据的类型 typeof instanof
       let arr = []
       console.log('title-typeof', typeof workTitle, typeof arr)
       console.log('title-instanceof', workTitle instanceof Object )
       console.log('title-instanceof', root instanceof Object )
    </script>
</body>
</html>